<template>
  <div class="assess sub-margin">
    <!-- <div class="sub-page-title">测评管理</div> -->
    <div class="content">
      <div class="search-box">
        <el-menu
          size="small"
          :default-active="activeCode"
          class="search-menu-box"
          mode="horizontal"
          @select="onMenuClick">
          <el-menu-item v-for="(item, key) in menuInfo" :key="key" :index="key">
            {{ item.label }}
          </el-menu-item>
        </el-menu>
      </div>
      <evaluation-select :status="selStatus" :tab="curTab" @select="onParamSelect"></evaluation-select>
      <div class="table-con">
        <div :class="['left-con', curTab !== '1' ? 'narrow-left-con' : '']">
          <audit-org-list
            v-if="curTab === '1'"
            ref="auditOrgList"
            :params="selectParam"
            @select="onOrgList"></audit-org-list>
          <org-list v-else :select-param="selectParam" @select="onResultList"></org-list>
        </div>
        <div class="right-con">
          <EvaluationSumMainNew
            :tab="curTab"
            :org-info="orgInfo"
            :params="selectParam"
            @success="onSuccess"></EvaluationSumMainNew>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import EvaluationSelect from './components/EvaluationSelect'
import AuditOrgList from './components/AuditOrgList.vue'
import OrgList from './components/OrgList.vue'
import EvaluationSumMainNew from './EvaluationSumMainNew.vue'
export default {
  name: 'minZhuAssess',
  components: { AuditOrgList, EvaluationSelect, OrgList, EvaluationSumMainNew },
  props: {},
  data() {
    return {
      curTab: '1',
      menuInfo: {
        person: {
          label: '人员审核',
          status: '1',
        },
        result: {
          label: '测评结果',
          status: '2',
        },
      },
      activeCode: 'person',
      auditStatus: [
        {
          label: '全部',
          value: '',
        },
        {
          label: '待审核',
          value: '-1',
        },
        {
          label: '审核未通过',
          value: '0',
        },
        {
          label: '审核通过',
          value: '1',
        },
        {
          label: '进行中',
          value: '2',
        },
        {
          label: '已结束',
          value: '3',
        },
        // {
        //   label: '暂停中',
        //   value: '4',
        // },
      ], // 审核状态
      comStatus: [
        { label: '全部', value: '0' },
        { label: '已完成', value: '1' },
        { label: '未完成', value: '2' },
      ], // 完成状态
      selectParam: {
        assessmentStatus: '',
        key: '',
        pageNum: 1,
        pageSize: 10,
      },
      orgInfo: {},
    }
  },
  watch: {},
  computed: {
    selStatus() {
      return this.curTab === '1' ? this.auditStatus : this.comStatus
    },
  },
  created() {},
  mounted() {},
  methods: {
    onMenuClick(code) {
      this.activeCode = code
      this.curTab = this.menuInfo[this.activeCode].status
    },
    onParamSelect(obj) {
      this.selectParam = Object.assign(this.selectParam, obj)
    },

    /* 获取测评人员列表 */
    onOrgList(obj) {
      this.orgInfo = obj
    },

    /* 获取测评结果列表 */
    onResultList(obj) {
      this.orgInfo = obj
    },

    /* 监听页面操作，刷新页面 */
    onSuccess() {
      if (this.$refs.auditOrgList) {
        this.$refs.auditOrgList.getOrgList()
      }
    },
  },
}
</script>
<style lang="scss" scoped>
@import '@styles/layout.scss';
.assess {
  height: 100%;
  .content {
    // height: calc(100% - 78px);
    height: calc(100%);
    padding-bottom: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    .search-box {
      width: 100%;
      .el-menu {
        .is-active {
          font-weight: bold;
          font-size: 16px;
        }
      }
    }
    .table-con {
      flex: 1;
      display: flex;
      align-items: stretch;
      height: calc(100% - 120px);

      .left-con {
        width: 300px;
        &.narrow-left-con {
          width: 200px;
          min-width: 200px;
        }
      }
      .right-con {
        flex: 1;
      }
    }
  }
}
</style>
